Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
ansi-diff-stream
Advanced tools
A transform stream that diffs input buffers and outputs the diff as ANSI. If you pipe this to a terminal it will update the output with minimal changes.
A transform stream that diffs input buffers and outputs the diff as ANSI. If you pipe this to a terminal it will update the output with minimal changes.
npm install ansi-diff-stream
var differ = require('ansi-diff-stream')
var diff = differ()
setInterval(function () {
diff.write(
'This is a demo\n' +
'The time is: ' + new Date() + '\n' +
'That is all'
)
}, 500)
diff.pipe(process.stdout)
Running the above example will produce an output that looks like this:
This is a demo
The time is: Thu Jul 14 2016 19:46:56 GMT+0200 (CEST)
That is all
Every half second the time will update. The diff produced by running the above means that the terminal will move the cursor to the beginning of the time stamp only update that part.
For a more advanced example see example.js
.
var stream = differ()
Create a new diff stream. You should pipe it to a ansi capable stream.
stream.reset()
Will reset the diff. Useful you print something manually inbetween updates.
stream.clear()
Clear the last printed output from the screen. Similar to doing stream.write('')
.
There is a command line tools available as
npm install -g ansi-diff-stream
nc -l 10000 | ansi-diff-stream
In another terminal
nc localhost 10000
hello
world
MIT
FAQs
A transform stream that diffs input buffers and outputs the diff as ANSI. If you pipe this to a terminal it will update the output with minimal changes.
The npm package ansi-diff-stream receives a total of 7,619 weekly downloads. As such, ansi-diff-stream popularity was classified as popular.
We found that ansi-diff-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.